

/**
 * 查看PPT
 * 
 */
/*function viewPpt(){
	$( "body" ).prepend( '<div class="quanping" ></div>' );
	$( ".quanping" ).after( '<div id="ppt-view"></div>' );
	$( "#ppt-view" ).load( "../manage/view/viewPpt.html", null, 
		function( response, status, xml ) {
			if ( status === "success" ) {
				$( ".quanping" ).height( $(document).height() );
				$( "#ppt-view > .manage-frame" ).fadeIn( "normal" );
				getData( userId );
			} else {
				alert( "查看失败！" );
				$("#ppt-view, .quanping").remove();
			}
		}
	);
}
*/

function viewPpt(){
	/**
	 * rowData 获取到所选择行的数据
	 * 
	 * @type {Object}
	 */
	var rowid = $( "#manage-ppt" ).jqGrid( 'getGridParam', 'selarrrow' );
	var rowData = $("#manage-ppt").jqGrid("getRowData", rowid[0]);
	
	if ( rowid.length > 0 ){
		window.open("../ppt/join.html?id="+rowData.id);
	}
	else {
		alert( "请先选择一行！" );
	}
	
	
	
}
//删除该用户

function deletePpt() {

	/**
	 * rows 获取所选择行的ID，支持单选、多选
	 *
	 * @type {Object}
	 */

	var rows = $( "#manage-ppt" ).jqGrid( 'getGridParam', 'selarrrow' );

	/**
	 * rowsData
	 *
	 * @type {Object}
	 */

	var rowsData;
	
	// 判断是否选中行
	if ( rows.length > 0 ) {
		if ( confirm( "您确认要删除PPT吗?" ) ) {

			// 循环遍历所选择行，获取行GlobalID
			//for ( var i = 0; i <rows.length; i++ ) {
			rowsData = $( "#manage-ppt" ).jqGrid( "getRowData", rows[0] );
			$.ajax({
				type: "POST",
				contentType: "application/x-www-form-urlencoded;charset=UTF-8",
				url: "../exam/delete.html",
				data: "id=" + rowsData.id,
				success: function() {
					alert( "删除成功！" );
					$( "#manage-ppt" ).trigger( "reloadGrid" );
				},
				error: function(textStatus) {
					alert( textStatus );
				}
			});
		}
	} else {
		alert( "请先选择一行！" );
	}
}

/**
 * getData 根据userId获取详细数据
 * 
 */

function getData(userId) {
	$.ajax({
		type: "POST",
		contentType: "application/x-www-form-urlencoded;charset=UTF-8",
		url: "..",
		data: "userIds=" + userId,
		success: function(result) {
			
		},
		error: function(textStatus) {
			alert( "加载用户数据失败！" );
		}
	});
}





//关闭预览页面
$(".preview-close").click(function(){			
	$(".quanping").remove();									 
	$(this).parents("div[class='preview-frame']").fadeOut("slow");
});